<!DOCTYPE html>
<html>
<head>
    <title>查询支付宝订单</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="keywords"
          content="Flat Dark Web Login Form Responsive Templates, Iphone Widget Template, Smartphone login forms,Login form, Widget Template, Responsive Templates, a Ipad 404 Templates, Flat Responsive Templates"/>
    <script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
    <script src="../js/jsencrypt.min.js"></script>
    <script src="../js/jquery.params.js"></script>
    <script src="../js/api.js"></script>
    <style type="text/css">
        table.gridtable {
            font-family: verdana, arial, sans-serif;
            font-size: 11px;
            color: #333333;
            border-width: 1px;
            border-color: #666666;
            border-collapse: collapse;
        }

        table.gridtable th {
            border-width: 1px;
            padding: 8px;
            border-style: solid;
            border-color: #666666;
            background-color: #dedede;
        }

        table.gridtable td {
            border-width: 1px;
            padding: 8px;
            border-style: solid;
            border-color: #666666;
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<h1>查询支付宝订单</h1>
<div class="login-form">
    <div class="close"></div>
    <div class="head-info">
        <label class="lbl-1"> </label>
        <label class="lbl-2"> </label>
        <label class="lbl-3"> </label>
    </div>
    <div class="clear"></div>
    <br/>
    对内订单号：
    <input id="out_trade_no" type="text"/>
    <br/>
    <div id="order_info"></div>
    <div class="signin">
        <button class="btn" onclick="query()">查询订单</button>
    </div>
</div>
<br/>
<hr/>
<table class="gridtable">
    <tbody id="tbody1">
    </tbody>
</table>
<br/>
<hr/>
<button class="btn" onclick="account_downloadurl()">对账单</button>
<script>
    function account_downloadurl() {
        var json = {};
        var params = JSON.stringify(json).replace(/:/g, "=").replace(/"/g, "").replace(/ /g, "");
        var data = request("reconciliation_downloadurl", "", "0", json, params);

        console.log(data);
    }

    function query() {
        var json = {
            "out_trade_no": $("#out_trade_no").val()
        };
        var params = JSON.stringify(json).replace(/:/g, "=").replace(/"/g, "").replace(/ /g, "");
        var data = request("order_queryAliOrder", "", "0", json, params);
        console.log(data.order_info);
        console.log(JSON.parse(data.order_info)['alipay_trade_query_response']);
        var orderInfo = JSON.parse(data.order_info)['alipay_trade_query_response'];
        var tableData = "<tr><th>对外订单号</th>" +
            "<th>对内订单号</th>" +
            "<th>订单总金额</th>" +
            "<th>打款时间</th>" +
            "<th>支付状态</th>" +
            "<th>消息</th>" +
            "<th>code</th></tr>";
        tableData += "<tr>";
        tableData += "<td>" + orderInfo.trade_no + "</td>";
        tableData += "<td>" + orderInfo.out_trade_no + "</td>";
        tableData += "<td>" + orderInfo.total_amount + "</td>";
        tableData += "<td>" + orderInfo.send_pay_date + "</td>";
        tableData += "<td>" + orderInfo.trade_status + "</td>";
        tableData += "<td>" + orderInfo.msg + "</td>";
        tableData += "<td>" + orderInfo.code + "</td>";
        tableData += "</tr>";
        console.log(tableData);
        document.getElementById("tbody1").innerHTML = tableData;
    }
</script>
</body>
</html>